
BaseFrame = class("BaseFrame")

function BaseFrame:ctor()    
    self.panels = {}
    self.widgets = {}
    
    local canvas = CS.UnityEngine.GameObject.FindGameObjectWithTag("Canvas")
    self.canvas = canvas
    util.dump(canvas)
end

function BaseFrame:start()
    
end

function BaseFrame:addPanel(panelConfig, ...)
    local cls = panelConfig.cls
    local res = panelConfig.res

    local newPanel = cls.new(self.canvas.gameObject, res, {...})
    table.insert(self.panels, newPanel)
end

function BaseFrame:addWidget(cls, ...)
end

function BaseFrame:onDestroy()
    for k,panel in pairs(self.panels) do
        GameObject.Destroy(panel.go)
    end
end


return BaseFrame